#ifndef STATUSEVENT_H_
#define STATUSEVENT_H_

#include "../Buddy.h"
#include <wx/event.h>
#include "StatusEventTypes.h"

namespace Impp
{

class StatusEvent : public wxNotifyEvent
{
private:
	Buddy* buddy;
	Status oldStatus;
	Status newStatus;
	wxString oldStatusMsg;
	wxString statusMsg;
	StatusEventType statusEventType;
	StatusConnectionType statusConnType;

public:
	StatusEvent(Buddy* b, const Status & oldS, const Status & newS,const wxString & oldStatusMsg, const wxString & statusMsg, const StatusEventType & statusEventType, const StatusConnectionType & statusConnType, wxEventType eventType = wxEVT_NULL, int id = 0);
	virtual ~StatusEvent();

	Buddy* getBuddy();
	Status getOldStatus();
	Status getNewStatus();
	wxString getStatusMsg();
	StatusEventType getStatusEventType();
	StatusConnectionType getStatusConnectionType();

	bool isStatusDifferent(bool ignoreCustom = false);
	bool isMsgDifferent();

	void changeStatusMsgTo(const wxString& newStatusMsg);

	virtual wxEvent* Clone()const;
};


typedef void(wxEvtHandler::*StatusEventFunction)(StatusEvent&);

BEGIN_DECLARE_EVENT_TYPES()
  DECLARE_EVENT_TYPE(EVT_BUDDY_STATUS_CHANGED, -1)
  DECLARE_EVENT_TYPE(EVT_OWN_STATUS_CHANGED, -1)
  DECLARE_EVENT_TYPE(EVT_OWN_STATUS_CHANGING, -1)
END_DECLARE_EVENT_TYPES()

#define StatusEventHandler(func)                                                 \
        (wxObjectEventFunction)                                                \
        (wxEventFunction)wxStaticCastEvent(StatusEventFunction, &func)

}

#endif /*STATUSEVENT_H_*/
